/// <summary>
/// method for checking if the system is running a
/// 64-bit OS
/// </summary>
/// <returns>true/false</returns>
private bool is64Bit()
{
    bool is64 = false;

    //check if the 32 bit program files folder exists
    if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ProgramFiles(x86)"))) 
    {
        //not found so return true
        is64 = true;
    }

    //use Reflection to see if running in 32-bit mode
    if (is64 == false)
    {
        //loop through all the loaded assemblies looking for 64-bit framework
        foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) 
        {
            //look for the 64-bit framework
            if (assembly.Location.ToLower().Contains("framework64"))
            {
                //found it so must be 64-bit OS
                is64 = true;
                break;
            }
                
        }
    }
    //made it this far so it's a 32-bit OS
    return is64;
}